Making Dynamic Links Search Engine Friendly |
||||
Before we can explain how to achieve this, we need to look into the reasons why and to explain one of the most common problems found with search engines and dynamic sites. | ||||
|
||||
Using .htacces and mod_rewrite |
||||
Mod_rewrite is considered the Swiss Army Knife of URL manipulation; it allows you to show a URL that does not actually exist on your server and transform it on the server to the correct file. So the link above could be shown as http://www.paramiliar.com/thepage_1_7_string.html This URL is very friendly to search engines, it is the kind of link they will eat and eat and eat until they are gauged on data. |
||||
So how do we achieve this? First, we must ensure the mod_rewrite module for Apache is installed. Now that we have checked the module is active, we can create an .htaccess file to handle the rewrite. In our example above, we are changing: thepage.php?this=1&is=7&query=string To thepage_1_7_string.html To do this we use the following text in the .htaccess file |
||||
|
||||
Now to explain this, Line 1 tells apache to turn the RewriteEngine On, this is what does the magic, it instructs Apache on the server to turn on the Rewrite Engine. Line 2 is where the magic begins, first we declare that the line is a Rewrite Rule, second we tell it the file to expect, this is in the format of thepage_(.*)_(.*)_(.*).html so if we looked at thepage_firststring_secondstring_thirdstring.html we would load the values firststring, secondstring and thirdstring into the script. The second part of the line tells the RewriteEngine what file it is to translate it into. The $1, $2, $3 represent each (.*) section so if we translated this line we would come up with Thepage_first_second_third.html Thepage.php?this=first&is=second&query=third |
||||
So calling thepage_first_second_third.html would tell the server to execute thepage.php?this=first&is=second&query=third This means a search engine could now index the html page while the server can show the dynamic content it wants to. So those are the steps to take to make your dynamic unfriendly URL’s dynamic friendly ones which search engines will love. |
||||
But how can you utilise this in your links? Well instead of getting your Dynamic scripts to produce the link thepage.php?this=1&is=2&query=3 you would get the script to link to thepage_1_2_3.html instead! | ||||
So to recap on what you have learned, you have learnt of a common problem with search engines and dynamic sites, What mod_rewrite is and how to "Mask" the pages of your site to make them more dynamic. | ||||
Kind Regards |